broadway: Improve logging
authorAlexander Larsson <alexl@redhat.com>
Thu, 30 Nov 2017 13:47:08 +0000 (14:47 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 30 Nov 2017 20:57:42 +0000 (21:57 +0100)
We now log backwards, so that the latest is always visible.
Also, we use <pre> with a smaller size.

gdk/broadway/broadway.js

index 5474960bc74044a47ccf8daf5296c2f23fc35121..4e15ecd3ab36ef28e4879164c21903e4e21d5977 100644 (file)
@@ -2,13 +2,14 @@
 var logDiv = null;
 function log(str) {
     if (!logDiv) {
-        logDiv = document.createElement('div');
+        logDiv = document.createElement('pre');
         document.body.appendChild(logDiv);
         logDiv.style["position"] = "absolute";
         logDiv.style["right"] = "0px";
+        logDiv.style["font-size"] = "small";
     }
-    logDiv.appendChild(document.createTextNode(str));
-    logDiv.appendChild(document.createElement('br'));
+    logDiv.insertBefore(document.createElement('br'), logDiv.firstChild);
+    logDiv.insertBefore(document.createTextNode(str), logDiv.firstChild);
 }
 
 function getStackTrace()